Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Pivot table</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Pivot_table"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Pivot_table rootpage-Pivot_table skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Pivot table</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}


/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">For cross-tabulation that aggregates only by counting (rather than summing, averaging, etc.), see <a href="Contingency_table" title="Contingency table">Contingency table</a>. For tables used to resolve many-to-many relationships, see <a href="Associative_entity" title="Associative entity">Associative entity</a>.</div>
<p>
A <b>pivot table</b> is a <a href="Table_(information)" title="Table (information)">table</a> of values which are aggregations of groups of individual values from a more extensive table (such as from a <a href="Database" title="Database">database</a>, <a href="Spreadsheet" title="Spreadsheet">spreadsheet</a>, or <a href="Business_intelligence_software" title="Business intelligence software">business intelligence program</a>) within one or more discrete categories. The aggregations or summaries of the groups of the individual terms might include sums, averages, counts, or other statistics. A pivot table is the outcome of the statistical processing of tabularized raw data and can be used for decision-making.
</p><p>Although <i>pivot table</i> is a generic term, <a href="Microsoft" title="Microsoft">Microsoft</a> held a trademark on the term in the United States from 1994 to 2020.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="History">History</h2></div>
<p>In their book <i>Pivot Table Data Crunching</i>,<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> Bill Jelen and Mike Alexander refer to <a href="Pito_Salas" title="Pito Salas">Pito Salas</a> as the "father of pivot tables". While working on a concept for a new program that would eventually become <a href="Lotus_Improv" title="Lotus Improv">Lotus Improv</a>, Salas noted that spreadsheets have patterns of data. A tool that could help the user recognize these patterns would help to build advanced data models quickly. With Improv, users could define and store sets of categories, then change views by dragging category names with the mouse. This core functionality would provide the model for pivot tables.
</p><p><a href="Lotus_Software" title="Lotus Software">Lotus Development</a> released Improv in 1991 on the <a href="NeXT" title="NeXT">NeXT</a> platform. A few months after the release of Improv, <a href="Brio_Technology" title="Brio Technology">Brio Technology</a> published a standalone <a href="Macintosh" class="mw-redirect" title="Macintosh">Macintosh</a> implementation, called DataPivot (with technology eventually patented in 1999).<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> <a href="Borland" title="Borland">Borland</a> purchased the DataPivot technology in 1992 and implemented it in their own spreadsheet application, <a href="Quattro_Pro" title="Quattro Pro">Quattro Pro</a>.
</p><p>In 1993 the Microsoft Windows version of Improv appeared. Early in 1994 <a href="Microsoft_Excel" title="Microsoft Excel">Microsoft Excel</a>&nbsp;5<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> brought a new functionality called a "PivotTable" to market. Microsoft further improved this feature in later versions of Excel:
</p>
<ul><li>Excel 97 included a new and improved PivotTable Wizard, the ability to create calculated fields, and new pivot cache objects that allow developers to write <a href="Visual_Basic_for_Applications" title="Visual Basic for Applications">Visual Basic for Applications</a> macros to create and modify pivot tables</li>
<li>Excel 2000 introduced "Pivot Charts" to represent pivot-table data graphically</li>
<li>Office 365 added the <a rel="nofollow" class="external text" href="https://excelcurve.com/dynamic-arrays-excel-2025/">PIVOTBY</a> function to Excel allowing users to create summary of data via a function verse building a Pivot Table.<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup></li></ul>
<p>In 2007 Oracle Corporation made <code>PIVOT</code> and <code>UNPIVOT</code> operators available in <a href="Oracle_Database" title="Oracle Database">Oracle Database</a> 11g.<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Mechanics">Mechanics</h2></div>
<p>For typical data entry and storage, data usually appear in <i>flat</i> tables, meaning that they consist of only columns and rows, as in the following portion of a sample spreadsheet showing data on shirt types:
</p>
<table class="wikitable">
<tbody><tr>
<th>
</th>
<th>A
</th>
<th>B
</th>
<th>C
</th>
<th>D
</th>
<th>E
</th>
<th>F
</th>
<th>G
</th></tr>
<tr>
<th>1
</th>
<td><b>Region</b>
</td>
<td><b>Gender</b>
</td>
<td><b>Style</b>
</td>
<td><b>Ship date</b>
</td>
<td><b>Units</b>
</td>
<td><b>Price</b>
</td>
<td><b>Cost</b>
</td></tr>
<tr>
<th>2
</th>
<td>East
</td>
<td>Boy
</td>
<td>Tee
</td>
<td>2005-01-31
</td>
<td>12
</td>
<td>11.04
</td>
<td>10.42
</td></tr>
<tr>
<th>3
</th>
<td>East
</td>
<td>Boy
</td>
<td>Golf
</td>
<td>2005-01-31
</td>
<td>12
</td>
<td>13.00
</td>
<td>12.60
</td></tr>
<tr>
<th>4
</th>
<td>East
</td>
<td>Boy
</td>
<td>Fancy
</td>
<td>2005-01-31
</td>
<td>12
</td>
<td>11.96
</td>
<td>11.74
</td></tr>
<tr>
<th>5
</th>
<td>East
</td>
<td>Girl
</td>
<td>Tee
</td>
<td>2005-01-31
</td>
<td>10
</td>
<td>11.27
</td>
<td>10.56
</td></tr>
<tr>
<th>6
</th>
<td>East
</td>
<td>Girl
</td>
<td>Golf
</td>
<td>2005-01-31
</td>
<td>10
</td>
<td>12.12
</td>
<td>11.95
</td></tr>
<tr>
<th>7
</th>
<td>East
</td>
<td>Girl
</td>
<td>Fancy
</td>
<td>2005-01-31
</td>
<td>10
</td>
<td>13.74
</td>
<td>13.33
</td></tr>
<tr>
<th>8
</th>
<td>West
</td>
<td>Boy
</td>
<td>Tee
</td>
<td>2005-01-31
</td>
<td>11
</td>
<td>11.44
</td>
<td>10.94
</td></tr>
<tr>
<th>9
</th>
<td>West
</td>
<td>Boy
</td>
<td>Golf
</td>
<td>2005-01-31
</td>
<td>11
</td>
<td>12.63
</td>
<td>11.73
</td></tr>
<tr>
<th>10
</th>
<td>West
</td>
<td>Boy
</td>
<td>Fancy
</td>
<td>2005-01-31
</td>
<td>11
</td>
<td>12.06
</td>
<td>11.51
</td></tr>
<tr>
<th>11
</th>
<td>West
</td>
<td>Girl
</td>
<td>Tee
</td>
<td>2005-01-31
</td>
<td>15
</td>
<td>13.42
</td>
<td>13.29
</td></tr>
<tr>
<th>12
</th>
<td>West
</td>
<td>Girl
</td>
<td>Golf
</td>
<td>2005-01-31
</td>
<td>15
</td>
<td>11.48
</td>
<td>10.67
</td></tr>
<tr>
<th>⋮
</th>
<td>…
</td>
<td>…
</td>
<td>…
</td>
<td>…
</td>
<td>…
</td>
<td>…
</td>
<td>…
</td></tr></tbody></table>
<p>While tables such as these can contain many data items, it can be difficult to get summarized information from them. A pivot table can help quickly summarize the data and highlight the desired information. The usage of a pivot table is extremely broad and depends on the situation. The first question to ask is, "What am I seeking?" In the example here, let us ask, "How many <i>Units</i> did we sell in each <i>Region</i> for every <i>Ship Date?</i>":
</p>
<table class="wikitable">
<tbody><tr>
<th>Sum of units
</th>
<th>Ship date ▼
</th></tr>
<tr>
<th>Region ▼
</th>
<th>2005-01-31
</th>
<th>2005-02-28
</th>
<th>2005-03-31
</th>
<th>2005-04-30
</th>
<th>2005-05-31
</th>
<th>2005-06-30
</th></tr>
<tr>
<td>East
</td>
<td style="text-align: right">66
</td>
<td style="text-align: right">80
</td>
<td style="text-align: right">102
</td>
<td style="text-align: right">116
</td>
<td style="text-align: right">127
</td>
<td style="text-align: right">125
</td></tr>
<tr>
<td>North
</td>
<td style="text-align: right">96
</td>
<td style="text-align: right">117
</td>
<td style="text-align: right">138
</td>
<td style="text-align: right">151
</td>
<td style="text-align: right">154
</td>
<td style="text-align: right">156
</td></tr>
<tr>
<td>South
</td>
<td style="text-align: right">123
</td>
<td style="text-align: right">141
</td>
<td style="text-align: right">157
</td>
<td style="text-align: right">178
</td>
<td style="text-align: right">191
</td>
<td style="text-align: right">202
</td></tr>
<tr>
<td>West
</td>
<td style="text-align: right">78
</td>
<td style="text-align: right">97
</td>
<td style="text-align: right">117
</td>
<td style="text-align: right">136
</td>
<td style="text-align: right">150
</td>
<td style="text-align: right">157
</td></tr>
<tr>
<td>(blank)
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td></tr>
<tr>
<td><b>Grand total</b>
</td>
<td style="text-align: right"><b>363</b>
</td>
<td style="text-align: right"><b>435</b>
</td>
<td style="text-align: right"><b>514</b>
</td>
<td style="text-align: right"><b>581</b>
</td>
<td style="text-align: right"><b>622</b>
</td>
<td style="text-align: right"><b>640</b>
</td></tr></tbody></table>
<p>A pivot table usually consists of <i>row</i>, <i>column</i> and <i>data</i> (or <i>fact</i>) fields. In this case, the column is <i>ship date</i>, the row is <i>region</i> and the data we would like to see is (sum of) <i>units</i>. These fields allow several kinds of <a href="Aggregate_function" title="Aggregate function">aggregations</a>, including: sum, average, <a href="Standard_deviation" title="Standard deviation">standard deviation</a>, count, etc. In this case, the total number of units shipped is displayed here using a <i>sum</i> aggregation.
</p>
<div class="mw-heading mw-heading2"><h2 id="Implementation">Implementation</h2></div>
<p>Using the example above, the software will find all distinct values for <i>Region</i>. In this case, they are: <i>North</i>, <i>South</i>, <i>East</i>, <i>West</i>. Furthermore, it will find all distinct values for <i>Ship date</i>. Based on the aggregation type, <i>sum</i>, it will summarize the fact, the quantities of <i>Unit</i>, and display them in a multidimensional chart. In the example above, the first datum is 66. This number was obtained by finding all records where both <i>Region</i> was <i>East</i> and <i>Ship Date</i> was <i>2005-01-31</i>, and adding the <i>Units</i> of that collection of records (<i>i.e.</i>, cells E2 to E7) together to get a final result.
</p><p>Pivot tables are not created automatically. For example, in Microsoft Excel one must first select all of the data in the original table and then go to the Insert tab and select "Pivot Table" (or "Pivot Chart"). The user then has the option of either inserting the pivot table into an existing sheet or creating a new sheet to house the pivot table. A pivot table field list is provided to the user which lists all the column headers present in the data. For instance, if a table represents sales data of a company, it might include Date of sale, Sales person, Item sold, Color of item, Units sold, Per unit price, and Total price. This makes the data more readily accessible.
</p>
<table class="wikitable">

<tbody><tr>
<th>Date of sale</th>
<th>Sales person</th>
<th>Item sold</th>
<th>Color of item</th>
<th>Units sold</th>
<th>Per unit price</th>
<th>Total price
</th></tr>
<tr>
<td>2013-10-01</td>
<td>Jones</td>
<td>Notebook</td>
<td>Black</td>
<td style="text-align: right">8</td>
<td style="text-align: right"><span class="nowrap">25<span style="margin-left:.25em;">000</span></span></td>
<td style="text-align: right"><span class="nowrap">200<span style="margin-left:.25em;">000</span></span>
</td></tr>
<tr>
<td>2013-10-02</td>
<td>Prince</td>
<td>Laptop</td>
<td>Red</td>
<td style="text-align: right">4</td>
<td style="text-align: right"><span class="nowrap">35<span style="margin-left:.25em;">000</span></span></td>
<td style="text-align: right"><span class="nowrap">140<span style="margin-left:.25em;">000</span></span>
</td></tr>
<tr>
<td>2013-10-03</td>
<td>George</td>
<td>Mouse</td>
<td>Red</td>
<td style="text-align: right">6</td>
<td style="text-align: right">850</td>
<td style="text-align: right">5100
</td></tr>
<tr>
<td>2013-10-04</td>
<td>Larry</td>
<td>Notebook</td>
<td>White</td>
<td style="text-align: right">10</td>
<td style="text-align: right"><span class="nowrap">27<span style="margin-left:.25em;">000</span></span></td>
<td style="text-align: right"><span class="nowrap">270<span style="margin-left:.25em;">000</span></span>
</td></tr>
<tr>
<td>2013-10-05</td>
<td>Jones</td>
<td>Mouse</td>
<td>Black</td>
<td style="text-align: right">4</td>
<td style="text-align: right">700</td>
<td style="text-align: right">2800
</td></tr></tbody></table>

<p>The fields that would be created will be visible on the right hand side of the worksheet. By default, the pivot table layout design will appear below this list.
</p><p>Pivot Table fields are the building blocks of pivot tables. Each of the fields from the list can be dragged on to this layout, which has four options:
</p>
<ol><li>Filters</li>
<li>Columns</li>
<li>Rows</li>
<li>Values</li></ol>
<p>Some uses of pivot tables are related to the analysis of questionnaires with optional responses but some implementations of pivot tables do not allow these use cases. For example the implementation in <a href="LibreOffice_Calc" title="LibreOffice Calc">LibreOffice Calc</a> since 2012 is not able to process empty cells.<sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="Filters">Filters</h3></div>
<p>Report filter is used to apply a filter to an entire table. For example, if the "Color of Item" field is dragged to this area, then the table constructed will have a report filter inserted above the table. This report filter will have drop-down options (Black, Red, and White in the example above). When an option is chosen from this <a href="Drop-down_list" title="Drop-down list">drop-down list</a> ("Black" in this example), then the table that would be visible will contain only the data from those rows that have the "Color of Item= Black".
</p>
<div class="mw-heading mw-heading3"><h3 id="Columns">Columns</h3></div>
<p>Column labels are used to apply a filter to one or more columns that have to be shown in the pivot table. For instance if the "Salesperson" field is dragged to this area, then the table constructed will have values from the column "Sales Person", <i>i.e.</i>, one will have a number of columns equal to the number of "Salesperson". There will also be one added column of Total. In the example above, this instruction will create five columns in the table&nbsp;— one for each salesperson, and Grand Total. There will be a filter above the data&nbsp;— column labels&nbsp;— from which one can select or deselect a particular salesperson for the pivot table.
</p><p>This table will not have any numerical values as no numerical field is selected but when it is selected, the values will automatically get updated in the column of "Grand total".
</p>
<div class="mw-heading mw-heading3"><h3 id="Rows">Rows</h3></div>
<p>Row labels are used to apply a filter to one or more rows that have to be shown in the pivot table. For instance, if the "Salesperson" field is dragged on this area then the other output table constructed will have values from the column "Salesperson", <i>i.e.</i>, one will have a number of rows equal to the number of "Sales Person". There will also be one added row of "Grand Total". In the example above, this instruction will create five rows in the table&nbsp;— one for each salesperson, and Grand Total. There will be a filter above the data&nbsp;— row labels&nbsp;— from which one can select or deselect a particular salesperson for the Pivot table.
</p><p>This table will not have any numerical values, as no numerical field is selected, but when it is selected, the values will automatically get updated in the Row of "Grand Total".
</p>
<div class="mw-heading mw-heading3"><h3 id="Values">Values</h3></div>
<p>This usually takes a field that has numerical values that can be used for different types of calculations. However, using text values would also not be wrong; instead of Sum, it will give a count. So, in the example above, if the "Units sold" field is dragged to this area along with the row label of "Salesperson", then the instruction will add a new column, "Sum of units sold", which will have values against each salesperson.
</p>
<table class="wikitable">

<tbody><tr>
<th>Row labels</th>
<th>Sum of units sold
</th></tr>
<tr>
<td>Jones
</td>
<td style="text-align: right">12
</td></tr>
<tr>
<td>Prince
</td>
<td style="text-align: right">4
</td></tr>
<tr>
<td>George
</td>
<td style="text-align: right">6
</td></tr>
<tr>
<td>Larry
</td>
<td style="text-align: right">10
</td></tr>
<tr>
<td>Grand total
</td>
<td style="text-align: right">32
</td></tr></tbody></table>
<div class="mw-heading mw-heading2"><h2 id="Application_support">Application support</h2></div>
<p>Pivot tables or pivot functionality are an integral part of many <a href="List_of_spreadsheet_software" title="List of spreadsheet software">spreadsheet applications</a> and some <a href="Database_software" class="mw-redirect" title="Database software">database software</a>, as well as being found in other data visualization tools and <a href="Business_intelligence" title="Business intelligence">business intelligence</a> packages.
</p>
<div class="mw-heading mw-heading3"><h3 id="Spreadsheets">Spreadsheets</h3></div>
<ul><li><a href="Microsoft_Excel" title="Microsoft Excel">Microsoft Excel</a> supports PivotTables, which can be visualized through PivotCharts.<sup id="cite_ref-Dalgleish2007_9-0" class="reference"><a href="#cite_note-Dalgleish2007-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup></li>
<li><a href="Apache_POI" title="Apache POI">Apache POI</a><sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup></li>
<li><a href="LibreOffice_Calc" title="LibreOffice Calc">LibreOffice Calc</a> and <a href="OpenOffice.org" title="OpenOffice.org">Openoffice Calc</a> support pivot tables. Prior to version 3.4, this feature was named "DataPilot".</li>
<li><a href="Calligra_Sheets" title="Calligra Sheets">Calligra Sheets</a> supports pivot tables.<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup></li>
<li><a href="Google_Sheets" title="Google Sheets">Google Sheets</a> natively supports pivot tables.<sup id="cite_ref-12" class="reference"><a href="#cite_note-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup></li>
<li><a href="Numbers_(spreadsheet)" title="Numbers (spreadsheet)">Numbers</a>, from <a href="Apple_Inc." title="Apple Inc.">Apple Inc.</a>, gained pivot table support in version 11.2.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>13<span class="cite-bracket">]</span></a></sup></li></ul>
<div class="mw-heading mw-heading3"><h3 id="Database_support">Database support</h3></div>
<ul><li><a href="PostgreSQL" title="PostgreSQL">PostgreSQL</a>, an <a href="Object%E2%80%93relational_database" title="Object–relational database">object–relational database management system</a>, allows the creation of pivot tables using the <i>tablefunc</i> module.<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">[</span>14<span class="cite-bracket">]</span></a></sup></li>
<li><a href="MariaDB" title="MariaDB">MariaDB</a>, a MySQL fork, allows pivot tables using the CONNECT storage engine.<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">[</span>15<span class="cite-bracket">]</span></a></sup></li>
<li><a href="Microsoft_Access" title="Microsoft Access">Microsoft Access</a> supports pivot queries under the name "crosstab" query. </li>
<li><a href="Microsoft_SQL_Server" title="Microsoft SQL Server">Microsoft SQL Server</a> supports pivot as of SQL Server 2016 with the FROM...PIVOT keywords<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">[</span>16<span class="cite-bracket">]</span></a></sup></li>
<li><a href="Oracle_Database" title="Oracle Database">Oracle Database</a> supports the PIVOT operation.</li>
<li>Some popular databases that do not directly support pivot functionality, such as <a href="SQLite" title="SQLite">SQLite</a>, can usually simulate pivot functionality using embedded functions, dynamic SQL or subqueries. The issue with pivoting in such cases is usually that the number of output columns must be known at the time the query starts to execute; for pivoting this is not possible as the number of columns is based on the data itself. Therefore, the names must be <a href="Hard_coded" class="mw-redirect" title="Hard coded">hard coded</a> or the query to be executed must itself be created dynamically (meaning, prior to each use) based upon the data.</li></ul>
<div class="mw-heading mw-heading3"><h3 id="Web_applications">Web applications</h3></div>
<ul><li><a href="ZK_(framework)" title="ZK (framework)">ZK</a>, an Ajax framework, also allows the embedding of pivot tables in Web applications.</li></ul>
<div class="mw-heading mw-heading3"><h3 id="Programming_languages_and_libraries">Programming languages and libraries</h3></div>
<p>Programming languages and libraries suited to work with tabular data contain functions that allow the creation and manipulation of pivot tables.
</p>
<ul><li><a href="Python_(programming_language)" title="Python (programming language)">Python</a> data analysis toolkit <a href="Pandas_(software)" title="Pandas (software)">pandas</a> has the function <code>pivot_table</code><sup id="cite_ref-17" class="reference"><a href="#cite_note-17"><span class="cite-bracket">[</span>17<span class="cite-bracket">]</span></a></sup> and the <code>xs</code> method useful to obtain sections of pivot tables.</li>
<li><a href="R_(programming_language)" title="R (programming language)">R</a> has the <a href="Tidyverse" title="Tidyverse">Tidyverse</a> metapackage, which contains a collection of tools providing pivot table functionality,<sup id="cite_ref-18" class="reference"><a href="#cite_note-18"><span class="cite-bracket">[</span>18<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-19" class="reference"><a href="#cite_note-19"><span class="cite-bracket">[</span>19<span class="cite-bracket">]</span></a></sup> as well as the pivottabler package.<sup id="cite_ref-20" class="reference"><a href="#cite_note-20"><span class="cite-bracket">[</span>20<span class="cite-bracket">]</span></a></sup></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Online_analytical_processing">Online analytical processing</h2></div>
<p>Excel pivot tables include the feature to directly query an <a href="Online_analytical_processing" title="Online analytical processing">online analytical processing</a> (OLAP) server for retrieving data instead of getting the data from an Excel spreadsheet. On this configuration, a pivot table is a simple client of an OLAP server. Excel's PivotTable not only allows for connecting to Microsoft's Analysis Service, but to any <a href="XML_for_Analysis" title="XML for Analysis">XML for Analysis</a> (XMLA) OLAP standard-compliant server.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1184024115">
/* start https://en.wikipedia.org/ */


.mw-parser-output .div-col{margin-top:0.3em;column-width:30em}.mw-parser-output .div-col-small{font-size:90%}.mw-parser-output .div-col-rules{column-rule:1px solid #aaa}.mw-parser-output .div-col dl,.mw-parser-output .div-col ol,.mw-parser-output .div-col ul{margin-top:0}.mw-parser-output .div-col li,.mw-parser-output .div-col dd{page-break-inside:avoid;break-inside:avoid-column}


/* end https://en.wikipedia.org/ */
</style><div class="div-col" style="column-width: 20em;">
<ul><li><a href="Aggregate_function" title="Aggregate function">Aggregate function</a></li>
<li><a href="Financial_reporting" class="mw-redirect" title="Financial reporting">Business reporting</a></li>
<li><a href="Comparison_of_office_suites" title="Comparison of office suites">Comparison of office suites</a></li>
<li><a href="Comparison_of_OLAP_servers" title="Comparison of OLAP servers">Comparison of OLAP servers</a></li>
<li><a href="Contingency_table" title="Contingency table">Contingency table</a>, a crosstab that tallies counts, rather than totals</li>
<li><a href="Data_drilling" title="Data drilling">Data drilling</a></li>
<li><a href="Data_mining" title="Data mining">Data mining</a></li>
<li><a href="Data_visualization" class="mw-redirect" title="Data visualization">Data visualization</a></li>
<li><a href="Data_warehouse" title="Data warehouse">Data warehouse</a></li>
<li><a href="Extract%2C_transform%2C_load" title="Extract, transform, load">Extract, transform, load</a></li>
<li><a href="Fold_(higher-order_function)" title="Fold (higher-order function)">Fold (higher-order function)</a></li>
<li><a href="OLAP_cube" title="OLAP cube">OLAP cube</a></li>
<li><a href="Relational_algebra" title="Relational algebra">Relational algebra</a></li>
<li><a href="Wide_and_narrow_data" title="Wide and narrow data">Wide and narrow data</a></li></ul></div>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist reflist-columns references-column-width" style="column-width: 30em;">
<ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://tsdr.uspto.gov/#caseNumber=74472929&amp;caseType=SERIAL_NO&amp;searchType=statusSearch">"United States Trademark Serial Number 74472929"</a>. December 27, 1994<span class="reference-accessdate">. Retrieved <span class="nowrap">March 23,</span> 2022</span>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text">
<cite id="CITEREFJelenAlexander2006" class="citation book cs1">Jelen, Bill; Alexander, Michael (2006). <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/pivottabledatacr0000jele"><i>Pivot table data crunching</i></a></span>. Indianapolis: Que. pp.&nbsp;<a rel="nofollow" class="external text" href="https://archive.org/details/pivottabledatacr0000jele/page/274">274</a>. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>0-7897-3435-4</bdi>.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text">
<cite id="CITEREFGartungEdholmEdholmMcNall" class="citation cs2">Gartung, Daniel L.; Edholm, Yorgen H.; Edholm, Kay-Martin; McNall, Kristen N.; Lew, Karl M., <a rel="nofollow" class="external text" href="https://patents.google.com/patent/US5915257"><i>Patent #5915257</i></a><span class="reference-accessdate">, retrieved <span class="nowrap">February 16,</span> 2010</span></cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text">
<cite id="CITEREFDarlington2012" class="citation book cs1">Darlington, Keith (August 6, 2012). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=LUBv6K6Yrw4C"><i>VBA For Excel Made Simple</i></a>. Routledge (published 2012). p.&nbsp;19. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>9781136349775</bdi><span class="reference-accessdate">. Retrieved <span class="nowrap">September 10,</span> 2014</span>. <q>[...] Excel 5, released in early 1994, included the first version of VBA.</q></cite></span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://support.microsoft.com/en-us/office/pivotby-function-de86516a-90ad-4ced-8522-3a25fac389cf">"PIVOTBY function - Microsoft Support"</a>. <i>support.microsoft.com</i><span class="reference-accessdate">. Retrieved <span class="nowrap">May 9,</span> 2025</span>.</cite></span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text">
<cite id="CITEREFShahShah2008" class="citation book cs1">Shah, Sharanam; Shah, Vaishali (2008). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=h6kcdn0a4RgC"><i>Oracle for Professionals – Covers Oracle 9i, 10g and 11g</i></a>. Shroff Publishing Series. Navi Mumbai: Shroff Publishers (published July 2008). p.&nbsp;549. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>9788184045260</bdi><span class="reference-accessdate">. Retrieved <span class="nowrap">September 10,</span> 2014</span>. <q>One of the most useful new features of the Oracle Database 11g from the SQL perspective is the introduction of Pivot and Unpivot operators.</q></cite></span>
</li>
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://stackoverflow.com/questions/68019239/libreoffice-calc-and-pivot-table-with-empty-cells/">"LibreOffice Calc and Pivot table with empty cells"</a>. <i><a href="StackOverflow" class="mw-redirect" title="StackOverflow">StackOverflow</a></i>. June 17, 2021<span class="reference-accessdate">. Retrieved <span class="nowrap">June 17,</span> 2021</span>.</cite></span>
</li>
<li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://bugs.documentfoundation.org/show_bug.cgi?id=47523">"Functionality request for PIVOTTABLE"</a>. <i>LibreOffice bugs</i>. March 19, 2012<span class="reference-accessdate">. Retrieved <span class="nowrap">June 17,</span> 2021</span>.</cite></span>
</li>
<li id="cite_note-Dalgleish2007-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-Dalgleish2007_9-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFDalgleish2007" class="citation book cs1">Dalgleish, Debra (2007). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=lleBg-leOhwC&amp;q=%22Pivot+chart%22+-wikipedia&amp;pg=PA233"><i>Beginning PivotTables in Excel 2007: From Novice to Professional</i></a>. Apress. pp.&nbsp;<span class="nowrap">233–</span>257. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>9781430204336</bdi><span class="reference-accessdate">. Retrieved <span class="nowrap">September 18,</span> 2018</span>.</cite></span>
</li>
<li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://poi.apache.org/components/spreadsheet/quick-guide.html#PivotTable">"Busy Developers' Guide to HSSF and XSSF Features"</a>. <i>poi.apache.org</i><span class="reference-accessdate">. Retrieved <span class="nowrap">December 9,</span> 2022</span>.</cite></span>
</li>
<li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://docs.kde.org/trunk5/en/calligra/sheets/pivottable.html">"Pivot Tables"</a>.</cite></span>
</li>
<li id="cite_note-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-12">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://support.google.com/docs/answer/1272900?co=GENIE.Platform%3DDesktop">"Create &amp; use pivot tables"</a>. <i>Docs Editors Help</i>. Google Inc<span class="reference-accessdate">. Retrieved <span class="nowrap">August 6,</span> 2020</span>.</cite></span>
</li>
<li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.macworld.com/article/539553/iwork-update-brings-major-changes-to-mac-iphone-and-ipad-apps.html">"iWork update brings major changes to Mac, iPhone, and iPad apps"</a>. <i>Macworld</i><span class="reference-accessdate">. Retrieved <span class="nowrap">September 28,</span> 2021</span>.</cite></span>
</li>
<li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.postgresql.org/docs/9.2/tablefunc.html">"PostgreSQL: Documentation: 9.2: tablefunc"</a>. <i>postgresql.org</i>. November 9, 2017.</cite></span>
</li>
<li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://mariadb.com/kb/en/connect-pivot-table-type/">"CONNECT Table Types – PIVOT Table Type"</a>. <i>mariadb.com</i>.</cite></span>
</li>
<li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://docs.microsoft.com/en-us/sql/t-sql/queries/from-transact-sql?view=sql-server-2017">"FROM clause plus JOIN, APPLY, PIVOT (T-SQL) – SQL Server"</a>.</cite></span>
</li>
<li id="cite_note-17"><span class="mw-cite-backlink"><b><a href="#cite_ref-17">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.pivot_table.html">"pandas.pivot_table"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">November 21,</span> 2023</span>.</cite></span>
</li>
<li id="cite_note-18"><span class="mw-cite-backlink"><b><a href="#cite_ref-18">^</a></b></span> <span class="reference-text"><cite class="citation book cs1"><a rel="nofollow" class="external text" href="https://jules32.github.io/r-for-excel-users/pivot.html"><i>dplyr and Pivot Tables</i></a>.</cite></span>
</li>
<li id="cite_note-19"><span class="mw-cite-backlink"><b><a href="#cite_ref-19">^</a></b></span> <span class="reference-text"><cite class="citation book cs1"><a rel="nofollow" class="external text" href="https://r4ds.had.co.nz/tidy-data.html?#pivoting"><i>Pivoting</i></a>.</cite></span>
</li>
<li id="cite_note-20"><span class="mw-cite-backlink"><b><a href="#cite_ref-20">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.pivottabler.org.uk/">"pivottabler"</a>.</cite></span>
</li>
</ol></div>
<div class="mw-heading mw-heading2"><h2 id="Further_reading">Further reading</h2></div>
<ul><li><i>A Complete Guide to PivotTables: A Visual Approach</i> (<a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>1-59059-432-0</bdi>)&nbsp;(in-depth review at slashdot.org)</li>
<li><i>Excel 2007 PivotTables and PivotCharts: Visual blueprint</i> (<a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>978-0-470-13231-9</bdi>)</li>
<li><i>Pivot Table Data Crunching</i> (Business Solutions) (<a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>0-7897-3435-4</bdi>)</li>
<li><i>Beginning Pivot Tables in Excel 2007</i> (<a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>1-59059-890-3</bdi>)</li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-07-02" href="https://en.wikipedia.org/wiki/?title=Pivot_table&amp;oldid=1298504409">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>